<!--
 /**
 * Author: hongChengHao
 * Date: 2022-07-23 14:36
 * Desc: shareUrl 分享链接
 */
-->
<template>
  <yy-page class="share-url">
    <view class="share-url__content">
      <view class="share-url__des share-url__border">选择要插入公众号的路径进行复制</view>
      <view class="share-url__copy share-url__border" v-if="['coupon', 'normal'].includes(this.type)">
        <copy-url title="套券页面路径" v-model="mallUrl"></copy-url>
      </view>
      <view class="share-url__copy">
        <copy-url title="主页路径" v-model="indexUrl"></copy-url>
      </view>

      <view class="share-url__instructions">
        <view class="mb30 fc3 fs30 b">插入公众号教程说明</view>
        <public-des :url="['https://public-oss-file.zmaxfilm.com/applet/img/my/img0-instructions.png', 'https://public-oss-file.zmaxfilm.com/applet/img/my/img1-instructions.png']">
          <view slot="title">插入到公众号菜单</view>
          <view slot="subTitle">在公众号菜单下方标记位置，粘贴刚刚复制的页面路径</view>
        </public-des>
        <public-des :url="['https://public-oss-file.zmaxfilm.com/applet/img/my/img1-instructions.png', 'https://public-oss-file.zmaxfilm.com/applet/img/my/img0-instructions.png']">
          <view slot="title">插入公众号文章</view>
          <view slot="subTitle">在公众号文章下方标记位置，粘贴刚刚复制的页面路径</view>
        </public-des>
      </view>
    </view>
  </yy-page>
</template>
<script>
  import CopyUrl from './components/CopyUrl.vue'
  import PublicDes from './components/PublicDes.vue'
  import { locShare } from '@/utils/locStore/data'
  export default {
    components: { CopyUrl, PublicDes },
    name: 'ShareUrl',
    onLoad(options) {
      this.type = options.type
    },
    data() {
      return {
        type: ''
      }
    },
    computed: {
      mallUrl() {
        const obj = locShare.get()
        const { shareQuery } = this.$auth.getShareInfo(obj)
        return `pages/goodDetail/index?sq=${shareQuery}`
      },
      indexUrl() {
        const obj = locShare.get()
        const { shareQuery } = this.$auth.getShareInfo(obj)
        const query = shareQuery.split(',').length > 3 ? shareQuery.split(',').slice(0, -1).join() : shareQuery
        return `pages/index/index?sq=${query}`
      }
    }
  }
</script>
<style lang="scss" scoped>
  .share-url {
    &__content {
      margin-bottom: 56uupx;
    }
    &__des {
      padding: 30upx 0upx 31upx 30upx;
      font-size: 30upx;
      font-family: PingFang SC;
      font-weight: bold;
      color: #333333;
      background: #fff;
    }
    &__copy {
      padding: 31upx 30upx 52upx 30upx;
      background: #fff;
    }
    &__border {
      border-bottom: 1upx solid #f3f5f7;
    }

    &__instructions {
      margin-top: 20upx;
      background: #fff;
      padding: 29upx 31upx 0 31upx;
    }
  }
</style>
